Repository navigation
feat(fleet): add the agent front door, the person-wait guard and user dispatch - #12227
Conversation
… dispatch One way in for every kind of agent, built from the verbs the fleet already has. - fleet agent: kinds, enroll, doctor, next, shortlist. `next` returns one task from the highest intake rung that has one: a pushed command, a queue claim, the host's shortlist (a run that finds it low refills it), then GitHub priority. Every step has a time limit, so a leg that does not answer is down, not a hang. - fleet shell: run a command or open a shell on the laptop, a codespace or here; --build takes a build slot. - fleet queue park and block refuse a wait on a person unless it is a hands item (FDR-0013), before the broker is asked. - Placement: a surface may say dispatch_as "user". fleet-org, fleet-org-blacksmith and fleet-forks are active, each proven by a real run on 2026-11-21. - Secrets: an optional op (1Password) source after the broker and bws, on only where FLEET_OP_VAULT names a vault. Design: doc/2026-11-21T11-30-00Z_design_fleet-agent-front-door. Checked: cargo test --workspace --all-targets --locked (942 passed); 25 injected faults each caught by a test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09ca66d3e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let line = match &opts.cwd { | ||
| Some(dir) => format!("cd {} && {command}", sh_quote(dir)), | ||
| None => command, | ||
| }; | ||
| ("sh".to_string(), vec!["-lc".to_string(), line]) |
There was a problem hiding this comment.
Honor --build when running directly on the laptop
When this seat is the laptop, resolve() selects Target::Local, but this branch ignores opts.build. Consequently, the normal fleet shell --build -- cargo test invocation executes bare Cargo without acquiring a build slot or applying the wrapper's parallelism controls. Apply the build wrapper on the local laptop path as well; otherwise concurrent agents bypass the mandatory fleet-wide build discipline in AGENTS.md.
AGENTS.md reference: AGENTS.md:L30-L32
Useful? React with 👍 / 👎.
| args.push(if opts.build { | ||
| format!("{BUILD_LOCK} {command}") |
There was a problem hiding this comment.
Execute the complete shell command under the build lock
For a supported single-string command such as fleet shell --target laptop --build -- 'cd pkgs/id && cargo test', this produces fleet-build-lock cd pkgs/id && cargo test. The wrapper declares command [args...] and ends with exec "$@" (pkgs/fleet/fleet-build-lock), so it cannot execute the shell builtin cd. With cargo check && cargo test, the second build instead runs outside the lock. Run the complete shell string through a shell beneath the wrapper so compound commands work and retain the build-slot discipline required by AGENTS.md.
AGENTS.md reference: AGENTS.md:L30-L32
Useful? React with 👍 / 👎.
| .and_then(|(_, v)| v.clone()) | ||
| .map(|v| v.trim().to_string()) | ||
| .filter(|v| !v.is_empty()) |
There was a problem hiding this comment.
Reject empty explicit option values instead of defaulting
Filtering empty values here makes an explicitly supplied option indistinguishable from an absent one. For example, fleet shell --target= -- true silently uses automatic target selection, while enrollment with --profile= falls back to the default profile and can overwrite it. Reject blank values during parsing rather than selecting defaults; the argument contract linked from AGENTS.md explicitly requires a present-but-valueless option to be a usage error before subprocesses or writes occur.
AGENTS.md reference: AGENTS.md:L47-L50
Useful? React with 👍 / 👎.
| let _ = shortlist::update(file, now, |list| { | ||
| list.handed.push(shortlist::Handed { | ||
| repo: entry.repo.clone(), | ||
| issue: entry.issue, | ||
| to: agent.clone(), |
There was a problem hiding this comment.
Select and reserve priority work within one locked update
Two concurrent next calls on the same host can both load the same handed-out history and select the same issue before either reaches this update. Although the update is locked, it only appends the previously selected issue without rechecking availability, so both agents receive identical implementation work. Perform candidate selection and reservation together inside the locked update so the second caller observes the first caller's reservation.
Useful? React with 👍 / 👎.
| let path = format!( | ||
| "repos/{repo}/issues?state=open&labels={}&per_page=30&sort=created&direction=asc", | ||
| encode_label(label) | ||
| ); |
There was a problem hiding this comment.
Paginate each priority rank before moving to the next
Each label query reads only its oldest 30 results, and held issues, busy issues, and pull requests are filtered afterward. If those excluded entries occupy the first page, eligible issues on subsequent pages are never considered: both shortlist filling and the priority rung can select lower-priority work or report no work indefinitely despite available higher-priority issues. Fetch subsequent pages until enough eligible candidates are collected or the rank is exhausted.
Useful? React with 👍 / 👎.
| // The fill is done: whoever held the purpose is released. | ||
| list.refill = None; |
There was a problem hiding this comment.
Allow real work after a low-volume shortlist refill
When only one to three eligible issues exist, filling the shortlist leaves it at or below the default low-water mark but clears the refill marker here. A lone agent following the returned fill then next sequence consequently receives another refill task from next.rs:407-409 instead of taking an existing issue. Subsequent fills add nothing and clear the marker again, indefinitely starving the available work. Preserve enough refill state to allow consumption after an unsuccessful attempt to reach the target.
Useful? React with 👍 / 👎.
| match list.take(&agent, now) { | ||
| Some(entry) => FromShortlist::Take(entry), |
There was a problem hiding this comment.
Recheck human holds before handing out cached shortlist work
If an owner adds held, user/owned, or do-not-auto-edit after an issue enters the shortlist, this path still removes the cached entry and returns it with implementation instructions. Shortlist entries neither expire nor refresh their labels, so the issue can remain eligible here indefinitely despite its current human hold. Check the current issue state and hold labels before handing it out, preserving the human-hold invariant defined in AGENTS.md.
AGENTS.md reference: AGENTS.md:L89-L91
Useful? React with 👍 / 👎.
| format!("fleet agent shortlist fill --agent {agent} --repo {repo}"), | ||
| format!( | ||
| "fleet agent shortlist add --agent {agent} --issue <n> --title <t> --why <reason>" | ||
| ), | ||
| format!("fleet agent next --agent {agent}"), |
There was a problem hiding this comment.
Preserve the selected shortlist in continuation commands
When next is invoked with --shortlist /custom/list.json, it records the refill marker in that file, but these continuation commands omit the selected path. Following the returned instructions therefore fills the default shortlist and subsequently requests work from that different file, leaving the originally selected shortlist unfilled. Carry the explicit shortlist path through the generated fill, add, and next commands, with appropriate shell quoting.
Useful? React with 👍 / 👎.
| } | ||
| hello | ||
| } | ||
| None => argv(&["bridge", "health"]), |
There was a problem hiding this comment.
Verify authenticated mailbox access in the doctor probe
On a seat with missing or invalid fleet credentials, this probe can still succeed because fleet bridge health performs an unauthenticated GET /healthz (fleet-bridge/src/lib.rs:758-761). doctor then reports the bridge as usable, sets rungs.push=true, and can exit successfully even when every actual intake route is unavailable; the subsequent inbox call requires fleet_token() and fails. Probe authenticated mailbox access, or distinguish public service health from authenticated intake availability before computing the reported rungs and exit status.
Useful? React with 👍 / 👎.
The dashboard census and the digest listed every user/escalated item as waiting on the owner. Under FDR-0013 a choice an agent parked on him is fleet work, so the census now splits items three ways: needs a person's hands (a hands:v1 marker in the body), review requested, and parked on the owner by an agent. Only the first two count in the heading and in the digest's Needs Drew section. fleet agent next reads the same marker: it never hands a hands item or a kind/tracker issue to an agent. The plan records step 0 as done: tracker #12238, issues #12228 to #12237, and decisions D9 to D12. Checked: bun test in pm-stack/aggregator (3037 passed), tsc --noEmit, cargo test for pkgs/fleet (943 passed); 9 injected faults each caught. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 280120ccdf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let code = if dry_run || any_intake(&legs) { | ||
| EXIT_OK | ||
| } else { | ||
| EXIT_DOWN |
There was a problem hiding this comment.
Require mailbox registration for HTTP-only agents
When enrolling an HTTP-only kind such as dot, a failed bridge registration still returns success if the enrolling machine can reach its queue or GitHub. Those legs belong to the enrolling machine, not the HTTP agent: Seat::Http has no shell and receives work only through the mailbox routes provided above. Consequently, enrollment can succeed while leaving the agent without a usable intake route. Require bridge registration to succeed for non-dry-run HTTP enrollment rather than accepting any local intake leg.
Useful? React with 👍 / 👎.
| let condition_kind = body["ready_condition"] | ||
| .get("kind") | ||
| .and_then(|k| k.as_str()) | ||
| .map(str::to_string); |
There was a problem hiding this comment.
Validate the effective ready condition from progress
When a caller supplies --progress '{"ready_condition":{"kind":"person_answer"}}' with a neutral reason such as choose encoding, this guard sees no condition and permits the park without --hands or --action. The broker subsequently falls back to given_progress.ready_condition in turso_queue/lifecycle.rs:1710-1714, creating precisely the person-answer wait this change is intended to refuse. Resolve the effective condition using the broker's fallback before checking it; this also prevents valid hands flags from being rejected for the same supported input form.
Useful? React with 👍 / 👎.
| None => { | ||
| let _ = child.kill(); | ||
| let _ = child.wait(); |
There was a problem hiding this comment.
Terminate descendant processes when a captured step times out
When a captured fleet invocation is waiting on a hung external CLI, killing only the fleet process leaves its subprocess running. Secret resolution invokes bws and op through Command::output() in fleet-secrets/src/lib.rs, so repeated timed-out next or doctor calls can accumulate orphaned credential processes even though each invocation reports a timeout. Start captured commands in their own process group and terminate that group on timeout so the step limit also bounds the work it launched.
Useful? React with 👍 / 👎.
|
All nine review findings on this PR were checked against the code, found real, and are fixed in #12243, each with a test that fails without the fix. Generated by Claude Code |
What this does
One way in for every kind of agent, built from the verbs the fleet already has, plus the guard that stops work being parked on a person.
fleet agent:kinds,enroll,doctor,next,shortlist. An agent of any kind (Muse, OpenCode, OpenChamber, OpenClaw, Grok, Dot, Duet, Codex, Gemini, Antigravity, Claude Code) enrols with one command.fleet agent nextreturns one task from the highest intake rung that has one: a pushed command, a queue claim, the host's shortlist, then GitHub priority. A run that finds the shortlist low is told to refill it.fleet shell: runs a command or opens a shell on the laptop, a codespace or here, so nothing builds in a limited sandbox.--buildtakes a build slot.No waits on a person:
fleet queue parkandfleet queue blockexit 2 unless the wait is a hands item (--hands,--action), before the broker is asked. Implements FDR-0013.Three more build surfaces: a surface entry may say
"dispatch_as": "user".fleet-org,fleet-org-blacksmithandfleet-forksare now active. They had waited on an App grant since 2026-11-04.Secrets: an optional
op(1Password) source after the broker andbws, on only whereFLEET_OP_VAULTnames a vault.Dashboard: the attention page's label census and the digest now count only hands items and review requests as needing the owner. A choice an agent parked on him is listed as fleet work.
fleet agent nextreads the samehands:v1marker and never hands a hands item or a tracker to an agent.Plan: step 0 is done. Tracker plan: results first — priorities and order of work (2026-11-21) #12238, issues fleet: sessions wedge on a walled or dead model door instead of failing over #12228 to hands: add the codespace scope to the fleet's gh login (one command) #12237, decisions D9 to D12.
Design and decisions:
doc/2026-11-21T11-30-00Z_design_fleet-agent-front-door/. Runbook:doc/agents/onboarding-an-agent.md.How it was checked
cargo test --manifest-path pkgs/fleet/Cargo.toml --workspace --all-targets --locked: 943 passed, 0 failed.bun testinpm-stack/aggregator: 3037 passed, 0 failed;tsc --noEmitclean.~was sent unquoted).repo-queuebinary against a fake broker that counts connections.fleet agentandfleet shellexit 69 there.pkgs/fleet/smoke.shis updated for the new capability.fleet-org), 44900255411 (fleet-org-blacksmith, on a Blacksmith runner) and 44900259404 (fleet-forks), all successful.fleet agent nextwas run against GitHub from a seat with no fleet broker and returned real ranked candidates.Not in this PR
feature_slicequeue kind. Large issues reach agents through the shortlist and priority rungs for now.fleet-run.yml; filed separately.https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
Generated by Claude Code